package net.hg.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.hg.service.FirstDtService;
import net.hg.utils.Result;
import net.hg.vo.FirstDtMenuListVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "一级菜单相关接口")
@RestController
@RequestMapping("/first")
@Slf4j
public class FirstDtController {
    /**
     * 服务对象
     */
    @Resource
    private FirstDtService firstDtService;

    @ApiOperation("获取所有菜单信息")
    @GetMapping("/getMenuLit")
    public Result<List<FirstDtMenuListVo>> getMenuLit() {
        log.info("获取菜单列表");
        List<FirstDtMenuListVo> menuList = firstDtService.getMenuList();
        if (menuList == null || menuList.size() <= 0) {
            return Result.error("获取菜单列表异常");
        }
        return Result.success(menuList);
    }

}

